from rest_framework import serializers
from .models import *
class CouponSer(serializers.ModelSerializer):
    good_name = serializers.SerializerMethodField(read_only=True)
    def get_good_name(self,obj):
        return obj.good.name
    class Meta:
        model = Coupon
        fields = '__all__'
        read_only_fields = ['id',]
class CouponTypeSer(serializers.ModelSerializer):
    class Meta:
        model = CouponType
        fields = "__all__"